<template>
  <div id="review">
    <h1 class="titleTag">审核</h1>
    <div v-show="!show" class="cardone">
      <h2 class="title2">车俩行驶证</h2>
      <el-row :gutter="30">
        <el-col :span="12">
          <div class="image">
            <img style="width:100%: overflow: hidden"
              src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575982342296&di=9887afb312914ae41a047a4d15c62c30&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20190129%2Fa05e6d1a31734b54a3e139795ca06a4e.jpeg"
              alt="" srcset="">
          </div>
        </el-col>
        <el-col :span="12">
          <el-form label-position="right" :model="ruleForm" :rules="rules" label-width="130px">
            <el-form-item label="注册号" prop="number">
              <el-input v-model="ruleForm.number" size="small"></el-input>
            </el-form-item>
            <el-form-item label="企业名称" prop="name">
              <el-input v-model="ruleForm.name" size="small"></el-input>
            </el-form-item>
            <el-form-item label="住所" prop="address">
              <el-input v-model="ruleForm.address" size="small"></el-input>
            </el-form-item>
            <el-form-item label="法定代表人姓名" prop="legalname">
              <el-input v-model="ruleForm.legalname" size="small"></el-input>
            </el-form-item>
            <el-form-item label="公司类型" prop="type">
              <el-input v-model="ruleForm.type" size="small"></el-input>
            </el-form-item>
            <el-form-item label="有效起始时间" prop="time1">
              <el-input v-model="ruleForm.time1" size="small"></el-input>
            </el-form-item>
            <el-form-item label="有效截止时间" prop="time2">
              <el-input v-model="ruleForm.time2" size="small"></el-input>
            </el-form-item>
            <el-form-item label="注册资本" prop="capital">
              <el-input v-model="ruleForm.capital" size="small"></el-input>
            </el-form-item>
            <el-form-item label="经营范围" prop="range">
              <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="ruleForm.range">
              </el-input>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
      <div class="submitBUTTON mt24">
        <button @click="show=true">下一页</button>
        <button @click="$router.go(-1)">返回</button>
      </div>
    </div>
    <div v-show="show" class="cardtwo">
      <h2 class="title2">车俩道路运输证</h2>
      <el-row :gutter="100">
        <el-col :span="10">
          <div class="image image2">
            <img style="width:100%: overflow: hidden"
              src="http://img.mp.itc.cn/upload/20170121/b0be40691a694c709c0fd684828591c0_th.jpg" alt="" srcset="">
          </div>
        </el-col>
        <el-col :span="14">
          <el-form label-position="left" :model="ruleForm" :rules="rules" label-width="130px">
            <el-form-item label="法人姓名" prop="personal">
              <el-input v-model="ruleForm.personal" size="small"></el-input>
            </el-form-item>
            <el-form-item label="性别" prop="sex">
              <el-input v-model="ruleForm.sex" size="small"></el-input>
            </el-form-item>
            <el-form-item label="民族" prop="nation">
              <el-input v-model="ruleForm.nation" size="small"></el-input>
            </el-form-item>
            <el-form-item label="出生年月日" prop="date">
              <el-input v-model="ruleForm.date" size="small"></el-input>
            </el-form-item>
            <el-form-item label="住址" prop="address2">
              <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="ruleForm.address2">
              </el-input>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
      <el-row :gutter="100">
        <el-col :span="10">
          <div class="image image2">
            <img style="width:100%: overflow: hidden"
              src="http://5b0988e595225.cdn.sohucs.com/q_70,c_zoom,w_640/images/20180710/d859892590f6481391d1e5dad6f25c8f.jpeg"
              alt="" srcset="">
          </div>
        </el-col>
        <el-col :span="14">
          <el-form label-position="left" :model="ruleForm" :rules="rules" label-width="130px">
            <el-form-item label="公民身份证号" prop="id">
              <el-input v-model="ruleForm.id" size="small"></el-input>
            </el-form-item>
            <el-form-item label="有效起始时间" prop="time3">
              <el-input v-model="ruleForm.time3" size="small"></el-input>
            </el-form-item>
            <el-form-item label="有效截止时间" prop="time4">
              <el-input v-model="ruleForm.time4" size="small"></el-input>
            </el-form-item>
            <el-form-item label="签发机关" prop="gear">
              <el-input v-model="ruleForm.gear" size="small"></el-input>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
      <div class="submitBUTTON mt24">
        <button @click="show=false">上一页</button>
        <button @click="submitTo()">确认</button>
      </div>
    </div>
  </div>
</template>

<script>
import { apiExamine } from "@/utils/api";
export default {
  name: "review",
  data() {
    return {
      show: false,
      ruleForm: {
        number: "",
        name: "",
        address: "",
        legalname: "",
        type: "",
        time1: "",
        time2: "",
        capital: "",
        range: "",
        personal: "",
        sex: "",
        nation: "",
        date: "",
        address2: "",
        id: "",
        time3: "",
        time4: "",
        gear: ""
      },
      rules: {
        number: { required: true, message: "请输入注册号", trigger: "blur" },
        name: { required: true, message: "请输入企业名称", trigger: "blur" },
        address: { required: true, message: "请输入住所", trigger: "blur" },
        legalname: {
          required: true,
          message: "请输入法定代表人姓名",
          trigger: "blur"
        },
        type: { required: true, message: "请输入公司类型", trigger: "blur" },
        time: {
          required: true,
          message: "请输入有效起始时间",
          trigger: "blur"
        },
        time2: {
          required: true,
          message: "请输入有效截止时间",
          trigger: "blur"
        },
        capital: { required: true, message: "请输入注册资本", trigger: "blur" },
        range: { required: true, message: "请输入经营范围", trigger: "blur" },
        personal: {
          required: true,
          message: "请输入法人姓名",
          trigger: "blur"
        },
        sex: { required: true, message: "请输入性别", trigger: "blur" },
        nation: { required: true, message: "请输入民族", trigger: "blur" },
        date: { required: true, message: "请输入出生年月日", trigger: "blur" },
        address2: { required: true, message: "请输入住址", trigger: "blur" },
        id: { required: true, message: "请输入身份证号", trigger: "blur" },
        time3: {
          required: true,
          message: "请输入身份证有效起始时间",
          trigger: "blur"
        },
        time4: {
          required: true,
          message: "请输入身份证有效截止时间",
          trigger: "blur"
        },
        gear: {
          required: true,
          message: "请输入身份证签发机关",
          trigger: "blur"
        }
      }
    };
  },
  created() {},
  mounted() {
    console.log(this.$route);
  },
  methods: {
    submitTo() {
      // 审核
      apiExamine({
        userid: this.$route.query.userid,
        idenid: this.$route.query.idenid,
        enrollId: this.ruleForm.number, //注册号
        companyName: "", //企业名称
        domicile: this.ruleForm.address, //住所
        name: "", //法定代表人姓名
        firmType: this.ruleForm.type, //公司类型
        enrollStartDate: this.ruleForm.time1, //营业照有效起始时间
        enrollEndDate: this.ruleForm.time2, //营业照有效截止时间
        enrollFuud: this.ruleForm.capital, //注册资本
        scope: this.ruleForm.range, //经营范围
        idenSex: this.ruleForm.sex == "男" ? 1 : 2, //性别
        ethnic: this.ruleForm.nation, //民族
        idenBirthday: this.ruleForm.date, //出生年月日
        idenAddress: this.ruleForm.address2, //住址
        idcard: this.ruleForm.id, //公民身份证号
        idenStartDate: this.ruleForm.time3, //身份证有效起始时间
        idenEnDate: this.ruleForm.time4, //身份证有效截止时间
        idenAuthority: this.ruleForm.gear //签发机关
      })
        .then(res => {
          this.$message({ message: "审核通过", type: "success" });
          this.$router.go(-1)
          // if (res.data.status == 2) {
          //   this.$message({ message: "审核中", type: "warning" });
          // } else if (res.data.status == 3) {
          //   this.$message({ message: "审核未通过", type: "error" });
          // } else if (res.data.status == 1) {
          //   this.$message({ message: "已认证", type: "success" });
          // }
        })
        .catch(error => {
          console.log(error);
        });
    }
  }
};
</script>

<style lang="scss" scoped>
#review {
  min-height: 100%;
  background-color: #fff;
  padding: 24px;
  box-sizing: border-box;
  .title2 {
    font-weight: normal;
    margin: 24px 0 14px;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.85);
    line-height: 20px;
  }
  .image {
    border: 1px solid rgba(0, 0, 0, 0.15);
    max-height: 360px;
    overflow-y: auto;
    img {
      width: 100%;
    }
    &.image2 {
      border: none;
      text-align: center;
      padding: 10px;
      img {
        width: 80%;
      }
    }
  }
}
</style>
